#include <iostream>
using std::cout;
using std::endl;

class Point {
public:
    Point(int x, int y):_ix(x), _iy(y){}
    int _ix = 0;//C++11
    int _iy = 0;
};

class A{
    int _num;
    double _price;
};
//sizeof(A) = 16

class B{
    int _num;
    int _price;
};
//sizeof(D) = 8


double division(double x,double y){
    if(y == 0){
        throw "Deivision by zero";
    }
    return x/y;
}

void test0(){
    double x = 100, y = 0;
    try{
        cout << division(x,y) << endl;
    }catch(const char *){ //catch匹配的是异常的类型
         cout << "hello，there is an error" << endl;
    }catch(double x){
        cout << "double " << x << endl;
    }
}

void test1(){
    Point pt(1,2);
    cout << sizeof(Point) << endl;
    cout << sizeof(pt) << endl;
}

void test2(){
    A a;
    B b;
    cout << "sizeof(A) = " << sizeof(A) << endl;
    cout << "sizeof(B) = " << sizeof(B) << endl;
}

int main(void){
    // test0();
    // test1();
    test2();
    return 0;
}

